<%-------------------------------------------------------------------
 * 页面名称：transManager1_content.jsp
 * 功能描述：待处理交易
 * Action  : accountList.do
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%@ page import="cn.agiledata.bank.transaction.form.*"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%@ page import="cn.agiledata.bank.account.service.IAccountConst"%>
<%@ page import="cn.agiledata.bank.account.service.AccountSummary"%>
<%
	String path = request.getContextPath();
	AccountSummary user = (AccountSummary) session
			.getAttribute(Constant.SESSION_ACCOUNT_SUMMARY);
	String errorMessage = (String) request.getSession().getAttribute(
			"errorMsg");
	request.getSession().removeAttribute("errorMsg");
%>
<script language="JavaScript" type="text/JavaScript">
<%if (!"".equals(errorMessage) && errorMessage != null) {%>
alert('<%=errorMessage%>');
<%}%>
function confirmAndLink(url,title) {
    if(title=='取消退款'){
        if (confirm("您确定要"+title+"吗?\n\n如果您还未收到卖家的货物,您可以因此操作造成损失。\n\n如果您已经收到货物,取消退款后,交易金额将直接划入卖家账户哦^-^")) {
            removeText();   
            location.href = url;
        }
    }else if(title=='同意退款'){
        if (confirm("您确定要"+title+"吗?\n\n如果您的货物未被退回,您可以因此操作造成损失。\n\n同意退款后,交易金额将直接划入买家账户哦^-^")) {
            removeText();   
            location.href = url;
        }
    }else if(title=='收货确认'){
        if (confirm("您确定要"+title+"吗?\n\n如果您还未收到卖家的货物,您可以因此操作造成损失。\n\n收货确认后,交易金额将直接划入卖家账户哦^-^")) {
            removeText();   
            location.href = url;
        }
    }else if (title=='申请退款'){
        var str = "1、您如果对此项交易存在疑义，或决定不再购买此商品，可申请退款。目前仅支持全额退款。\n";
        str = str+"2、如您已收到卖家商品，但商品不完全符合您的要求，您仍愿意接受商品，但希望卖家部分退款时：\n";
        str = str+"第一步，请点击申请退款；\n";
        str = str+"第二步，请与卖家协商重新发起一笔新的交易；\n";
        str = str+"第三步，新的交易进行付款时，在备注栏注明：此笔交易替换一笔申请退款的交易，同时注明详细交易信息，包括交易号、交易金额、商品信息、交易开始日期、交易结束日期；\n";
        str = str+"第四步，新的交易完成；\n";
        str = str+"第五步，双方确认上笔退款。\n";
        str = str+"3、双方就退款流程、退款方式，发生歧义时，请联系客服协助处理。";
        if (confirm(str)) {
            removeText();
            location.href = url;
        }
    }else if (confirm("您确定要"+title+"吗?")) {
        removeText();   
        location.href = url;
    }
}

function removeText(){
    document.getElementById("operateSpan").style.display='';
	document.getElementById("divList").style.display='none';
}

	
</script>
<html:form action="accountList.do" method="post">
	<input name="transactionId" type="hidden" />
	<div id="main">
		<div class="content_right">
			<div style="width:745px;margin-left:10px;">
				<div class="titleinfo">
					待处理交易
				</div>
				<div id="operateSpan" style="display:none;">
					<table width="100%" border="0" align="center" cellpadding="7"
						cellspacing="1" bgcolor="#f9e277" style="margin:10px 0;">
						<tr>
							<td bgcolor="#fffdf5">
								<table width="100%" border="0" cellpadding="3" cellspacing="0">
									<tr>
										<td width="3%" height="25" valign="top"
											style="border-bottom:1px solid #ccc;"></td>
										<td width="97%" align="left" class="red12b"
											style="border-bottom:1px solid #ccc;">
											特别提醒
										</td>
									</tr>
									<tr>
										<td valign="top">
											&nbsp;
										</td>
										<td align="left" class="font_gray"系统正在处理，请您稍等片刻！</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</div>
				<div class="edit_pass" id="divList">
					<table width="100%" class="tablestyle">
						<tr>
							<th>
								<span class="blue14">订单编号</span>
							</th>
							<th>
								<span class="blue14">交易编号</span>
							</th>
							<th>
								<span class="blue14">交易子账户</span>
							</th>
							<th>
								<span class="blue14">交易对方</span>
							</th>
							<th>
								<span class="blue14">交易模式</span>
							</th>
							<th>
								<span class="blue14">交易状态</span>
							</th>
							<th>
								<span class="blue14">交易时间</span>
							</th>
							<th>
								<span class="blue14">收/付</span>
							</th>
							<th>
								<span class="blue14">金额</span>
							</th>
							<th>
								<span class="blue14">操作</span>
							</th>
						</tr>
						<c:forEach var="account" items="${accountList.data}"
							varStatus="status">
							<c:if test="${status.index % 2 == 0}">
								<tr>
							</c:if>
							<c:if test="${status.index % 2 == 1}">
								<tr>
							</c:if>
							<td>
								<logic:notEmpty name="account" property="orderId">
									<logic:empty name="account" property="orderUrl">
										<bean:write name="account" property="orderId" />
									</logic:empty>
									<logic:notEmpty name="account" property="orderUrl">
										<a href="<bean:write name="account"  property="orderUrl" />"
											class="bluefont12u" target="_blank"> <bean:write
												name="account" property="orderId" /> </a>
									</logic:notEmpty>
								</logic:notEmpty>
							</td>
							<td>
								<a
									href="<%=path%>/page/transaction/accountHisQueryDetail.do?transactionID=<bean:write name="account" property="id"/>"
									class="bluefont12u"> <bean:write name="account"
										property="tranId" /> </a>
							</td>
							<td>
								<bean:write name="account" property="selfName" />
							</td>
							<td>
								<a
									href="<%=path%>/page/common/getAccount.do?accountId=<bean:write name="account"  property="accid"/>"
									class="bluefont12u"> <logic:empty name="account"
										property="name">
										<logic:empty name="account" property="email">
											<bean:write name="account" property="mobile" />
										</logic:empty>
										<logic:notEmpty name="account" property="email">
											<bean:write name="account" property="email" />
										</logic:notEmpty>
									</logic:empty> <logic:notEmpty name="account" property="name">
										<bean:write name="account" property="name" />
									</logic:notEmpty> </a>
							</td>
							<td>
								<bean:write name="account" property="trade" />
							</td>
							<td>
								<bean:write name="account" property="status" />
							</td>
							<td>
								<bean:write name="account" property="beginDate"
									format="yyyy-MM-dd HH:mm:ss" />
							</td>
							<td>
								<logic:equal name="account" property="comeOrGo" value="1">收</logic:equal>
								<logic:equal name="account" property="comeOrGo" value="0">付</logic:equal>
							</td>
							<td>
								<bean:write name="account" property="amount" />
								元
							</td>
							<td>
								<bean:define id="tranId">
									<bean:write name="account" property="tranId" />
								</bean:define>
								<!-- 待确认-->
								<logic:equal name="account" property="tranStatus" value="0">
									<!-- 买方可以付款，可以取消 -->
									<logic:equal name="account" property="comeOrGo" value="0">
										<a href="#" class="bluefont12u"
											onclick="confirmAndLink('<%=path%>/page/transaction/innerPay.do?step=1&transId=<bean:write name="account"  property="tranId"/>','付款')">付款</a>&nbsp;
                  <a href="#" class="bluefont12u"
											onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=6&isIfFinished=false&oldTranStatus=0','交易取消')">取消</a>&nbsp;
              </logic:equal>
								</logic:equal>

								<!-- 买方已付款，等待卖方发货 -->
								<logic:equal name="account" property="tranStatus" value="1">
									<!-- 卖方发货 -->
									<logic:equal name="account" property="comeOrGo" value="1">
										<a href="#" class="bluefont12u"
											onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=2&isIfFinished=false&oldTranStatus=1','发货')">发货</a>&nbsp;
              </logic:equal>
								</logic:equal>

								<!-- 卖方已发货，等待买方确认 -->
								<logic:equal name="account" property="tranStatus" value="2">
									<!-- 买方收货确认 -->
									<logic:equal name="account" property="comeOrGo" value="0">
										<a href="#" class="bluefont12u"
											onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=3&isIfFinished=false&oldTranStatus=2','收货确认')">收货确认</a>&nbsp;
              </logic:equal>
								</logic:equal>

								<!-- 等待买方付款-->
								<logic:equal name="account" property="tranStatus" value="5">
									<!-- 买方可以付款，可以取消 -->
									<logic:equal name="account" property="comeOrGo" value="0">
										<!-- 担保交易 -->
										<logic:equal name="account" property="trade" value="担保交易">
											<a href="#" class="bluefont12u"
												onclick="confirmAndLink('<%=path%>/page/transaction/innerPay.do?step=1&transId=<bean:write name="account"  property="tranId"/>','付款')">付款</a>&nbsp;
                  </logic:equal>
										<!-- 非担保交易 -->
										<logic:equal name="account" property="trade" value="无担保交易">
											<a href="#" class="bluefont12u"
												onclick="confirmAndLink('<%=path%>/page/transaction/innerPay.do?step=1&transId=<bean:write name="account"  property="tranId"/>','付款')">付款</a>&nbsp;
                  </logic:equal>
										<!-- 担保交易和非担保交易都有取消 -->
										<a href="#" class="bluefont12u"
											onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=6&isIfFinished=false&oldTranStatus=5','交易取消')">取消</a>&nbsp;
              </logic:equal>
									<!-- 卖方可以取消 -->
									<logic:equal name="account" property="comeOrGo" value="1">
										<a href="#" class="bluefont12u"
											onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=6&isIfFinished=false&oldTranStatus=5','交易取消')">取消</a>&nbsp;
              </logic:equal>
								</logic:equal>
								<!--买方已付款，等待卖方发货状态,买方申请退款-->
								<logic:equal name="account" property="tranStatus" value="1">
									<logic:equal name="account" property="comeOrGo" value="0">
										<a
											href="<%=path%>/page/transaction/accountHisQueryDetail.do?operate=apply&transactionID=<bean:write name="account" property="id"/>"
											class="bluefont12u"> 申请退款 </a>
										<%--                  <a href="#" class="bluefont12u" onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=7&isIfFinished=false&oldTranStatus=1','申请退款')">申请退款</a>&nbsp;--%>
									</logic:equal>
								</logic:equal>

								<!--卖方已发货，等待买方确认,买方申请退款-->
								<logic:equal name="account" property="tranStatus" value="2">
									<logic:equal name="account" property="comeOrGo" value="0">
										<a
											href="<%=path%>/page/transaction/accountHisQueryDetail.do?operate=apply&transactionID=<bean:write name="account" property="id"/>"
											class="bluefont12u"> 申请退款 </a>
										<%--                  <a href="#" class="bluefont12u" onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=7&isIfFinished=false&oldTranStatus=2','申请退款')">申请退款</a>&nbsp;--%>
									</logic:equal>
								</logic:equal>


								<!--申请退款状态,买方取消退款,进入下一个状态-->
								<logic:equal name="account" property="tranStatus" value="7">
									<logic:equal name="account" property="comeOrGo" value="0">
										<a href="#" class="bluefont12u"
											onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=10&isIfFinished=false&oldTranStatus=7','取消退款')">取消退款</a>&nbsp;
              </logic:equal>
								</logic:equal>

								<!--争议处理状态,买方取消退款,交易成功-->
								<logic:equal name="account" property="tranStatus" value="8">
									<logic:equal name="account" property="comeOrGo" value="0">
										<a href="#" class="bluefont12u"
											onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=10&isIfFinished=false&oldTranStatus=8','取消退款')">取消退款</a>&nbsp;
              </logic:equal>
								</logic:equal>

								<!--申请退款状态,卖方拒绝退款,进入争议处理-->
								<logic:equal name="account" property="tranStatus" value="7">
									<logic:equal name="account" property="comeOrGo" value="1">
										<a
											href="<%=path%>/page/transaction/accountHisQueryDetail.do?operate=confirm&transactionID=<bean:write name="account" property="id"/>"
											class="bluefont12u"> 处理退款 </a>
										<%--                  <a href="#" class="bluefont12u" onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=8&isIfFinished=false&oldTranStatus=7','拒绝退款')">拒绝退款</a>&nbsp;--%>
									</logic:equal>
								</logic:equal>

								<!--申请退款状态,卖方同意退款-->
								<%--          <logic:equal name="account" property="tranStatus" value="7">--%>
								<%--              <logic:equal name="account" property="comeOrGo" value="1">--%>
								<%--                  <a href="#" class="bluefont12u" onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=9&isIfFinished=false&oldTranStatus=7','同意退款')">同意退款</a>&nbsp;--%>
								<%--              </logic:equal>--%>
								<%--          </logic:equal>--%>

								<!--争议处理状态,卖方同意退款-->
								<logic:equal name="account" property="tranStatus" value="8">
									<logic:equal name="account" property="comeOrGo" value="1">
										<a
											href="<%=path%>/page/transaction/accountHisQueryDetail.do?operate=confirm&transactionID=<bean:write name="account" property="id"/>"
											class="bluefont12u"> 处理退款 </a>
										<%--                  <a href="#" class="bluefont12u" onclick="confirmAndLink('<%=path%>/page/transaction/accountList.do?tranid=<bean:write name="account"  property="tranId"/>&tranStatus=9&isIfFinished=false&oldTranStatus=8','同意退款')">同意退款</a>&nbsp;--%>
									</logic:equal>
								</logic:equal>
							</td>
							</tr>
						</c:forEach>
					</table>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td class="font_blue">
								<ad:PageBean name="accountList" />
							</td>
						</tr>
					</table>
					</td>
					</tr>
					</table>
				</div>
			</div>
		</div>
	</div>
</html:form>
